home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Core / Includes / UTheDebugger.h < prev   
Encoding:
Text File  |  1996-04-03  |  3.0 KB  |  101 lines  |  [TEXT/MPS ]

  1. // UTheDebugger.h
  2. // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4. #ifndef __UTHEDEBUGGER__
  5. #define __UTHEDEBUGGER__
  6.  
  7. // MacApp
  8.  
  9. #ifndef __MACAPPTYPES__
  10. #include "MacAppTypes.h"
  11. #endif
  12.  
  13. //----------------------------------------------------------------------------------------
  14. // Forward class declarations
  15. //----------------------------------------------------------------------------------------
  16.  
  17. class ClassDesc;
  18. class TObject;
  19.  
  20. //----------------------------------------------------------------------------------------
  21. // Global function declarations
  22. //----------------------------------------------------------------------------------------
  23.  
  24. // The following routines come to MacApp courtesy of Steve Jasik, and provide
  25. // support for Jasik's The Debugger from within the framework.
  26.  
  27. #if qDebug | qTheDebugger
  28. // The Debugger is installed if Exception Vector at 0x38 points to a PEA instruction
  29. inline Boolean TheDbgr_IsInstalled(void) { return *(short *)(*(long *)0x38) == 0x487A; }
  30. #endif
  31.  
  32. #if qTheDebugger
  33.  
  34. #if !qPowerPC
  35. // The following two inlines allow storage into a CODE segment without
  36. // getting a Memory Protection Violation from 'The Debugger':
  37.  
  38. inline pascal void TheDbgr_StoreWord(short value, void* addr) = {0x7008,0x4E47};    // MOVEQ #8,D0, TRAP #7
  39.  
  40. inline pascal void TheDbgr_StoreLong(short value, void* addr) = {0x7009,0x4E47};    // MOVEQ #9,D0, TRAP #7
  41. #endif
  42.  
  43. #if PRAGMA_ALIGN_SUPPORTED
  44. #pragma options align=mac68k
  45. #endif
  46.  
  47. typedef struct T_ObjList
  48. {
  49.     long        max_objs;
  50.     long        L_used;
  51.     long        n_holes;
  52.     TObject*    objs[1024];     // ptrs to the objects, longint indexing 
  53. };
  54.  
  55. typedef struct T_ClassList
  56. {
  57.     ClassDesc* classes[256];     // ptrs to the objects, longint indexing 
  58. };
  59.  
  60. //    NOTE: Boolean MUST BE A single byte
  61.  
  62. typedef struct T_ExtDbgr
  63. {
  64.     Boolean            isBeingDebugged;    // True if a Debugger & a .SYM file present }
  65.     short            MA_Version;            // = 2 for MacApp 3.1 else 0
  66.     short            n_classes;            // number of Object classes
  67.     T_ClassList**    pOrderedClass;        // the tbl of ordered classes, Handle if MA3.1
  68.     long            hCLASINFO;            // Handle to %_CLASINFO - MA3.0 and earlier
  69.     T_ObjList**        hMA_OBJ_List;        // Handle to list of MacApp Objects
  70.     long            MA_JMPtoTrap;        // @  %_JMP TO TRAP - MA3.0 and earlier 
  71.     long            MA_FailNObj;        // @ FailNonObject - MA3.0 and earlier
  72.     long            MA_DiscMeth;        // @ PDisciplineMethodCalls:BOOLEAN
  73.     T_ClassList**    MA_ClassTblPtr;        // Class Tbl Ptr - MA3.0 and earlier
  74.     long            MA_SelProcPtr;        // SelectorProcTable - MA3.0 and earlier
  75. };
  76.  
  77. #if PRAGMA_ALIGN_SUPPORTED
  78. #pragma options align=reset
  79. #endif
  80.  
  81. extern T_ExtDbgr gExtDbgr_Info;
  82.  
  83. #if !qPowerPC
  84. //    Debugger Callback - old was VAR ConsWR_Proc:Longint
  85. inline pascal Boolean TheDbgr_IsDbgrTask(T_ExtDbgr* comBlk, long* ConsWR_Proc) = {0x7007,0x4E47};    // MOVEQ #7,D0, TRAP #7
  86. #endif
  87.  
  88. //    procedures for the object list collector
  89.  
  90. void TheDbgr_Add_Object(TObject* objHdl);
  91.  
  92. void TheDbgr_Delete_Object(TObject* objHdl);
  93.  
  94. void TheDbgr_Init_Ext_Dbgr();
  95.  
  96. void TheDbgr_Adjust_ClassDescr_Ids(ClassDesc* pclassList, short numClasses);
  97.  
  98. #endif    // qTheDebugger
  99.  
  100. #endif // __UTHEDEBUGGER__
  101.